
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <meta charset="UTF-8"/>
      <title>SpotBugs Report</title>
      <style type="text/css">
		.tablerow0 {
			background: #EEEEEE;
		}

		.tablerow1 {
			background: white;
		}

		.detailrow0 {
			background: #EEEEEE;
		}

		.detailrow1 {
			background: white;
		}

		.tableheader {
			background: #b9b9fe;
			font-size: larger;
		}
		</style>
   </head>
   <body>
      <h1>SpotBugs Report</h1>
      <p>Produced using <a href="https://spotbugs.github.io">SpotBugs</a>4.4.2.</p>
      <p>Project: 
			jpacman[jpacman.main]</p>
      <h2>Metrics</h2>
      <p>1474 lines of code analyzed,
	in 53 classes, 
	in 9 packages.</p>
      <table width="500" cellpadding="5" cellspacing="2">
         <tr class="tableheader">
            <th align="left">Metric</th>
            <th align="right">Total</th>
            <th align="right">Density*</th>
         </tr>
         <tr class="tablerow0">
            <td>High Priority Warnings</td>
            <td align="right">4</td>
            <td align="right">2.71</td>
         </tr>
         <tr class="tablerow1">
            <td>Medium Priority Warnings</td>
            <td align="right">30</td>
            <td align="right">20.35</td>
         </tr>
         <tr class="$totalClass">
            <td>
               <b>Total Warnings</b>
            </td>
            <td align="right">
               <b>34</b>
            </td>
            <td align="right">
               <b>23.07</b>
            </td>
         </tr>
      </table>
      <p>
         <i>(* Defects per Thousand lines of non-commenting source statements)</i>
      </p>
      <p>
         <br/>
         <br/>
      </p>
      <h2>Summary</h2>
      <table width="500" cellpadding="5" cellspacing="2">
         <tr class="tableheader">
            <th align="left">Warning Type</th>
            <th align="right">Number</th>
         </tr>
         <tr class="tablerow0">
            <td>
               <a href="#Warnings_BAD_PRACTICE">Bad practice Warnings</a>
            </td>
            <td align="right">2</td>
         </tr>
         <tr class="tablerow1">
            <td>
               <a href="#Warnings_CORRECTNESS">Correctness Warnings</a>
            </td>
            <td align="right">6</td>
         </tr>
         <tr class="tablerow0">
            <td>
               <a href="#Warnings_MALICIOUS_CODE">Malicious code vulnerability Warnings</a>
            </td>
            <td align="right">8</td>
         </tr>
         <tr class="tablerow1">
            <td>
               <a href="#Warnings_PERFORMANCE">Performance Warnings</a>
            </td>
            <td align="right">9</td>
         </tr>
         <tr class="tablerow0">
            <td>
               <a href="#Warnings_SECURITY">Security Warnings</a>
            </td>
            <td align="right">2</td>
         </tr>
         <tr class="tablerow1">
            <td>
               <a href="#Warnings_STYLE">Dodgy code Warnings</a>
            </td>
            <td align="right">7</td>
         </tr>
         <tr class="tablerow0">
            <td>
               <b>Total</b>
            </td>
            <td align="right">
               <b>34</b>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h1>Warnings</h1>
      <p>Click on each warning link to see a full description of the issue, and
	    details of how to resolve it.</p>
      <h2>
         <a name="Warnings_BAD_PRACTICE">Bad practice Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#DMI_RANDOM_USED_ONLY_ONCE">Random object created and used only once</a>
            </td>
            <td width="10%" valign="top">High</td>
            <td width="70%">
               <p>Random object created and used only once in nl.tudelft.jpacman.npc.Ghost.getInterval()<br/>
                  <br/>
                  <br/>In file Ghost.java Ghost.java,
					
						line 80 80<br/>In class nl.tudelft.jpacman.npc.Ghost<br/>In method nl.tudelft.jpacman.npc.Ghost.getInterval()<br/>Called method java.util.Random.nextInt(int)<br/>At Ghost.java:[line 80]<br/>At Ghost.java:[line 80]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#DMI_RANDOM_USED_ONLY_ONCE">Random object created and used only once</a>
            </td>
            <td width="10%" valign="top">High</td>
            <td width="70%">
               <p>Random object created and used only once in nl.tudelft.jpacman.npc.Ghost.randomMove()<br/>
                  <br/>
                  <br/>In file Ghost.java Ghost.java,
					
						line 100 100<br/>In class nl.tudelft.jpacman.npc.Ghost<br/>In method nl.tudelft.jpacman.npc.Ghost.randomMove()<br/>Called method java.util.Random.nextInt(int)<br/>At Ghost.java:[line 100]<br/>At Ghost.java:[line 100]</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="Warnings_CORRECTNESS">Correctness Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#BED_BOGUS_EXCEPTION_DECLARATION">Non derivable method declares throwing an exception that isn't thrown</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Non derivable method nl.tudelft.jpacman.Launcher.main(String[]) declares throwing an exception that isn't thrown<br/>
                  <br/>
                  <br/>In file Launcher.java,
					
						line 211<br/>In class nl.tudelft.jpacman.Launcher<br/>In method nl.tudelft.jpacman.Launcher.main(String[])<br/>At Launcher.java:[line 211]<br/>Value java.io.IOException</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET">This method needlessly uses a String literal as a Charset encoding</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>This method "new java.io.InputStreamReader(InputStream, String)" needlessly uses a String literal to define an encoding.  A built-in Charset could be used instead like: new java.io.InputStreamReader(InputStream, Charset)<br/>
                  <br/>
                  <br/>In file MapParser.java,
					
						line 222<br/>In class nl.tudelft.jpacman.level.MapParser<br/>In method nl.tudelft.jpacman.level.MapParser.parseMap(InputStream)<br/>At MapParser.java:[line 222]<br/>Called method new java.io.InputStreamReader(InputStream, String)<br/>Called method new java.io.InputStreamReader(InputStream, Charset)</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#DMC_DUBIOUS_MAP_COLLECTION">Class holds a map-type field, but uses it as only a List</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Class nl.tudelft.jpacman.ui.ScorePanel holds a map-type field nl.tudelft.jpacman.ui.ScorePanel.scoreLabels, but uses it as only a List<br/>
                  <br/>
                  <br/>In file ScorePanel.java,
					
						lines 
						    to <br/>In class nl.tudelft.jpacman.ui.ScorePanel<br/>Field nl.tudelft.jpacman.ui.ScorePanel.scoreLabels<br/>In ScorePanel.java</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY">Class has a circular dependency with other classes</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Class nl.tudelft.jpacman.board.Square has a circular dependency with other classes<br/>
                  <br/>
                  <br/>In file Square.java,
					
						lines 17
						    to 111<br/>In class nl.tudelft.jpacman.board.Square<br/>In class nl.tudelft.jpacman.board.Unit<br/>At Square.java:[lines 17-111]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#S508C_NON_TRANSLATABLE_STRING">Method passes constant string to title/label of component</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method new nl.tudelft.jpacman.ui.PacManUI(Game, Map, Map, ScorePanel$ScoreFormatter) passes constant string to title/label of component<br/>
                  <br/>
                  <br/>In file PacManUI.java,
					
						line 71<br/>In class nl.tudelft.jpacman.ui.PacManUI<br/>In method new nl.tudelft.jpacman.ui.PacManUI(Game, Map, Map, ScorePanel$ScoreFormatter)<br/>At PacManUI.java:[line 71]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#S508C_NO_SETLABELFOR">JLabel doesn't specify what it's labeling</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>JLabel in method new nl.tudelft.jpacman.ui.ScorePanel(List) doesn't specify what it's labeling<br/>
                  <br/>
                  <br/>In file ScorePanel.java,
					
						line 60<br/>In class nl.tudelft.jpacman.ui.ScorePanel<br/>In method new nl.tudelft.jpacman.ui.ScorePanel(List)<br/>At ScorePanel.java:[line 60]</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="Warnings_MALICIOUS_CODE">Malicious code vulnerability Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP">May expose internal representation by returning reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.board.Unit.getSquare() may expose internal representation by returning Unit.square<br/>
                  <br/>
                  <br/>In file Unit.java Unit.java,
					
						line 54 54<br/>In class nl.tudelft.jpacman.board.Unit<br/>In method nl.tudelft.jpacman.board.Unit.getSquare()<br/>Field nl.tudelft.jpacman.board.Unit.square<br/>At Unit.java:[line 54]<br/>At Unit.java:[line 54]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP">May expose internal representation by returning reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.game.SinglePlayerGame.getLevel() may expose internal representation by returning SinglePlayerGame.level<br/>
                  <br/>
                  <br/>In file SinglePlayerGame.java SinglePlayerGame.java,
					
						line 56 56<br/>In class nl.tudelft.jpacman.game.SinglePlayerGame<br/>In method nl.tudelft.jpacman.game.SinglePlayerGame.getLevel()<br/>Field nl.tudelft.jpacman.game.SinglePlayerGame.level<br/>At SinglePlayerGame.java:[line 56]<br/>At SinglePlayerGame.java:[line 56]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP">May expose internal representation by returning reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.level.Player.getKiller() may expose internal representation by returning Player.killer<br/>
                  <br/>
                  <br/>In file Player.java Player.java,
					
						line 92 92<br/>In class nl.tudelft.jpacman.level.Player<br/>In method nl.tudelft.jpacman.level.Player.getKiller()<br/>Field nl.tudelft.jpacman.level.Player.killer<br/>At Player.java:[line 92]<br/>At Player.java:[line 92]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP">May expose internal representation by returning reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.level.Player.getSprite() may expose internal representation by returning Player.deathSprite<br/>
                  <br/>
                  <br/>In file Player.java Player.java,
					
						line 118 118<br/>In class nl.tudelft.jpacman.level.Player<br/>In method nl.tudelft.jpacman.level.Player.getSprite()<br/>Field nl.tudelft.jpacman.level.Player.deathSprite<br/>At Player.java:[line 118]<br/>At Player.java:[line 118]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP2">May expose internal representation by incorporating reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.board.Unit.occupy(Square) may expose internal representation by storing an externally mutable object into Unit.square<br/>
                  <br/>
                  <br/>In file Unit.java Unit.java,
					
						line 79 79<br/>In class nl.tudelft.jpacman.board.Unit<br/>In method nl.tudelft.jpacman.board.Unit.occupy(Square)<br/>Field nl.tudelft.jpacman.board.Unit.square<br/>Local variable named target<br/>At Unit.java:[line 79]<br/>At Unit.java:[line 79]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP2">May expose internal representation by incorporating reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>new nl.tudelft.jpacman.level.Level(Board, List, List, CollisionMap) may expose internal representation by storing an externally mutable object into Level.startSquares<br/>
                  <br/>
                  <br/>In file Level.java Level.java,
					
						line 105 105<br/>In class nl.tudelft.jpacman.level.Level<br/>In method new nl.tudelft.jpacman.level.Level(Board, List, List, CollisionMap)<br/>Field nl.tudelft.jpacman.level.Level.startSquares<br/>Local variable named startPositions<br/>At Level.java:[line 105]<br/>At Level.java:[line 105]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP2">May expose internal representation by incorporating reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.level.Player.setKiller(Unit) may expose internal representation by storing an externally mutable object into Player.killer<br/>
                  <br/>
                  <br/>In file Player.java Player.java,
					
						line 101 101<br/>In class nl.tudelft.jpacman.level.Player<br/>In method nl.tudelft.jpacman.level.Player.setKiller(Unit)<br/>Field nl.tudelft.jpacman.level.Player.killer<br/>Local variable named killer<br/>At Player.java:[line 101]<br/>At Player.java:[line 101]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#EI_EXPOSE_REP2">May expose internal representation by incorporating reference to mutable object</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>new nl.tudelft.jpacman.sprite.ImageSprite(Image) may expose internal representation by storing an externally mutable object into ImageSprite.image<br/>
                  <br/>
                  <br/>In file ImageSprite.java ImageSprite.java,
					
						line 29 29<br/>In class nl.tudelft.jpacman.sprite.ImageSprite<br/>In method new nl.tudelft.jpacman.sprite.ImageSprite(Image)<br/>Field nl.tudelft.jpacman.sprite.ImageSprite.image<br/>Local variable named img<br/>At ImageSprite.java:[line 29]<br/>At ImageSprite.java:[line 29]</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="Warnings_PERFORMANCE">Performance Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#DLC_DUBIOUS_LIST_COLLECTION">Class defines List based fields but uses them like Sets</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Class nl.tudelft.jpacman.board.Square defines List based fields but uses them like Sets<br/>
                  <br/>
                  <br/>In file Square.java,
					
						line 82<br/>In class nl.tudelft.jpacman.board.Square<br/>Field nl.tudelft.jpacman.board.Square.occupants<br/>At Square.java:[line 82]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#DLC_DUBIOUS_LIST_COLLECTION">Class defines List based fields but uses them like Sets</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Class nl.tudelft.jpacman.level.Level defines List based fields but uses them like Sets<br/>
                  <br/>
                  <br/>In file Level.java,
					
						line 144<br/>In class nl.tudelft.jpacman.level.Level<br/>Field nl.tudelft.jpacman.level.Level.players<br/>At Level.java:[line 144]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method new nl.tudelft.jpacman.level.Level(Board, List, List, CollisionMap) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file Level.java,
					
						line 103<br/>In class nl.tudelft.jpacman.level.Level<br/>In method new nl.tudelft.jpacman.level.Level(Board, List, List, CollisionMap)<br/>At Level.java:[line 103]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.level.MapParser.parseMap(InputStream) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file MapParser.java,
					
						line 226<br/>In class nl.tudelft.jpacman.level.MapParser<br/>In method nl.tudelft.jpacman.level.MapParser.parseMap(InputStream)<br/>At MapParser.java:[line 226]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.npc.ghost.Navigation.findNearest(Class, Square) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file Navigation.java,
					
						line 100<br/>In class nl.tudelft.jpacman.npc.ghost.Navigation<br/>In method nl.tudelft.jpacman.npc.ghost.Navigation.findNearest(Class, Square)<br/>At Navigation.java:[line 100]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.npc.ghost.Navigation.shortestPath(Square, Square, Unit) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file Navigation.java,
					
						line 57<br/>In class nl.tudelft.jpacman.npc.ghost.Navigation<br/>In method nl.tudelft.jpacman.npc.ghost.Navigation.shortestPath(Square, Square, Unit)<br/>At Navigation.java:[line 57]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.sprite.PacManSprites.directionSprite(String, int) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file PacManSprites.java,
					
						line 94<br/>In class nl.tudelft.jpacman.sprite.PacManSprites<br/>In method nl.tudelft.jpacman.sprite.PacManSprites.directionSprite(String, int)<br/>At PacManSprites.java:[line 94]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method new nl.tudelft.jpacman.ui.ScorePanel(List) does not presize the allocation of a collection<br/>
                  <br/>
                  <br/>In file ScorePanel.java,
					
						line 61<br/>In class nl.tudelft.jpacman.ui.ScorePanel<br/>In method new nl.tudelft.jpacman.ui.ScorePanel(List)<br/>At ScorePanel.java:[line 61]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#UEC_USE_ENUM_COLLECTIONS">Class uses an ordinary set or map with an enum class as the key</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Class nl.tudelft.jpacman.sprite.PacManSprites uses an ordinary set or map with an enum class as the key<br/>
                  <br/>
                  <br/>In file PacManSprites.java,
					
						line 94<br/>In class nl.tudelft.jpacman.sprite.PacManSprites<br/>In method nl.tudelft.jpacman.sprite.PacManSprites.directionSprite(String, int)<br/>At PacManSprites.java:[line 94]</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="Warnings_SECURITY">Security Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#PREDICTABLE_RANDOM">Predictable pseudorandom number generator</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>This random generator (java.util.Random) is predictable<br/>
                  <br/>
                  <br/>In file Ghost.java,
					
						line 80<br/>In class nl.tudelft.jpacman.npc.Ghost<br/>In method nl.tudelft.jpacman.npc.Ghost.getInterval()<br/>At Ghost.java:[line 80]<br/>Value java.util.Random</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#PREDICTABLE_RANDOM">Predictable pseudorandom number generator</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>This random generator (java.util.Random) is predictable<br/>
                  <br/>
                  <br/>In file Ghost.java,
					
						line 100<br/>In class nl.tudelft.jpacman.npc.Ghost<br/>In method nl.tudelft.jpacman.npc.Ghost.randomMove()<br/>At Ghost.java:[line 100]<br/>Value java.util.Random</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="Warnings_STYLE">Dodgy code Warnings</a>
      </h2>
      <table class="warningtable"
             width="100%"
             cellspacing="2"
             cellpadding="5">
         <tr class="tableheader">
            <th align="left">Warning</th>
            <th align="left">Priority</th>
            <th align="left">Details</th>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS">Unconstrained method converts checked exception to unchecked</a>
            </td>
            <td width="10%" valign="top">High</td>
            <td width="70%">
               <p>Unconstrained method nl.tudelft.jpacman.Launcher.makeLevel() converts checked exception to unchecked<br/>
                  <br/>
                  <br/>In file Launcher.java,
					
						line 96<br/>In class nl.tudelft.jpacman.Launcher<br/>In method nl.tudelft.jpacman.Launcher.makeLevel()<br/>At Launcher.java:[line 96]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS">Unconstrained method converts checked exception to unchecked</a>
            </td>
            <td width="10%" valign="top">High</td>
            <td width="70%">
               <p>Unconstrained method nl.tudelft.jpacman.points.PointCalculatorLoader.load() converts checked exception to unchecked<br/>
                  <br/>
                  <br/>In file PointCalculatorLoader.java,
					
						line 29<br/>In class nl.tudelft.jpacman.points.PointCalculatorLoader<br/>In method nl.tudelft.jpacman.points.PointCalculatorLoader.load()<br/>At PointCalculatorLoader.java:[line 29]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#EXS_EXCEPTION_SOFTENING_HAS_CHECKED">Constrained method converts checked exception to unchecked instead of another allowable checked exception</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Constrained method nl.tudelft.jpacman.sprite.PacManSprites.loadSprite(String) converts checked exception to unchecked instead of another allowable checked exception<br/>
                  <br/>
                  <br/>In file PacManSprites.java,
					
						line 148<br/>In class nl.tudelft.jpacman.sprite.PacManSprites<br/>In method nl.tudelft.jpacman.sprite.PacManSprites.loadSprite(String)<br/>At PacManSprites.java:[line 148]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#ITC_INHERITANCE_TYPE_CHECKING">Method uses instanceof on multiple types to arbitrate logic</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.level.PlayerCollisions.collide(Unit, Unit) uses instanceof on multiple types to arbitrate logic<br/>
                  <br/>
                  <br/>In file PlayerCollisions.java,
					
						line 35<br/>In class nl.tudelft.jpacman.level.PlayerCollisions<br/>In method nl.tudelft.jpacman.level.PlayerCollisions.collide(Unit, Unit)<br/>At PlayerCollisions.java:[line 35]</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#ITC_INHERITANCE_TYPE_CHECKING">Method uses instanceof on multiple types to arbitrate logic</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>Method nl.tudelft.jpacman.level.PlayerCollisions.playerColliding(Player, Unit) uses instanceof on multiple types to arbitrate logic<br/>
                  <br/>
                  <br/>In file PlayerCollisions.java,
					
						line 47<br/>In class nl.tudelft.jpacman.level.PlayerCollisions<br/>In method nl.tudelft.jpacman.level.PlayerCollisions.playerColliding(Player, Unit)<br/>At PlayerCollisions.java:[line 47]</p>
            </td>
         </tr>
         <tr class="tablerow0">
            <td width="20%" valign="top">
               <a href="#OCP_OVERLY_CONCRETE_PARAMETER">Method needlessly defines parameter with concrete classes</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.npc.ghost.Inky.followPath(List, Square): 1st parameter 'directions' could be declared as java.lang.Iterable instead<br/>
                  <br/>
                  <br/>In file Inky.java,
					
						line 116<br/>In class nl.tudelft.jpacman.npc.ghost.Inky<br/>In method nl.tudelft.jpacman.npc.ghost.Inky.followPath(List, Square)<br/>At Inky.java:[line 116]<br/>Value 1st parameter 'directions' could be declared as java.lang.Iterable instead</p>
            </td>
         </tr>
         <tr class="tablerow1">
            <td width="20%" valign="top">
               <a href="#OCP_OVERLY_CONCRETE_PARAMETER">Method needlessly defines parameter with concrete classes</a>
            </td>
            <td width="10%" valign="top">Medium</td>
            <td width="70%">
               <p>nl.tudelft.jpacman.npc.ghost.Navigation.addNewTargets(Unit, List, Set, Navigation$Node, Square): 2nd parameter 'targets' could be declared as java.util.Collection instead<br/>
                  <br/>
                  <br/>In file Navigation.java,
					
						line 65<br/>In class nl.tudelft.jpacman.npc.ghost.Navigation<br/>In method nl.tudelft.jpacman.npc.ghost.Navigation.addNewTargets(Unit, List, Set, Navigation$Node, Square)<br/>At Navigation.java:[line 65]<br/>Value 2nd parameter 'targets' could be declared as java.util.Collection instead</p>
            </td>
         </tr>
      </table>
      <p>
         <br/>
         <br/>
      </p>
      <p>
         <br/>
         <br/>
      </p>
      <h1>
         <a name="Details">Warning Types</a>
      </h1>
      <h2>
         <a name="BED_BOGUS_EXCEPTION_DECLARATION">Non derivable method declares throwing an exception that isn't thrown</a>
      </h2>
			
			<p>This method declares that it throws a checked exception that it does not throw. As this method is
			either a constructor, static method or private method, there is no reason for this method to declare
			the exception in its throws clause, and just causes calling methods to unnecessarily handle an exception
			that will never be thrown. The exception in question should be removed from the throws clause.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="CSI_CHAR_SET_ISSUES_USE_STANDARD_CHARSET">This method needlessly uses a String literal as a Charset encoding</a>
      </h2>
    		
    		<p>This method uses a string literal to specify a <code>Charset</code> encoding. However, the method invoked has an
    		alternative signature that takes a <code>Charset</code> object. You should use this signature, as this class is compiled
    		with JDK 7 (or better), and the <code>Charset</code> in question is available as a constant from the
    		<code>java.nio.charset.StandardCharsets</code> class.</p>
    		<p>Instead of specifying "UTF-8", use <code>StandardCharsets.UTF_8</code>, for instance. An added benefit of this is
    		that you will not need to catch <code>UnsupportedEncodingException</code>.</p>
    		
    	<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="DLC_DUBIOUS_LIST_COLLECTION">Class defines List based fields but uses them like Sets</a>
      </h2>
			
			<p>This class defines a field based on java.util.List, but uses it to some extent like a Set. Since
			lookup type operations are performed using a linear search for Lists, the performance for large
			Lists will be poor. If the list is known to only contain a small number of items (3, 4, etc), then it
			doesn't matter. Otherwise, consider changing this field's implementation to a set-based one. If order of
			iteration is important to maintain insert order, perhaps consider a LinkedHashSet.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="DMC_DUBIOUS_MAP_COLLECTION">Class holds a map-type field, but uses it as only a List</a>
      </h2>
			
			<p>This method instantiates a map-type field in a static initializer or constructor, but then only uses it
			through iteration. This means that this data structure should really just be a List&lt;SomeObject&gt;,
			where the class held by the list contains the two fields held by the key and value of the Map.
			It was likely done this way to avoid having to create a class, but this just obfuscates the purpose of the field.
			</p>
			
    	<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="DMI_RANDOM_USED_ONLY_ONCE">Random object created and used only once</a>
      </h2>

<p> This code creates a java.util.Random object, uses it to generate one random number, and then discards
the Random object. This produces mediocre quality random numbers and is inefficient.
If possible, rewrite the code so that the Random object is created once and saved, and each time a new random number
is required invoke a method on the existing Random object to obtain it.
</p>

<p>If it is important that the generated Random numbers not be guessable, you <em>must</em> not create a new Random for each random
number; the values are too easily guessable. You should strongly consider using a java.security.SecureRandom instead
(and avoid allocating a new SecureRandom for each random number needed).
</p>

    <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="EI_EXPOSE_REP">May expose internal representation by returning reference to mutable object</a>
      </h2>

  <p> Returning a reference to a mutable object value stored in one of the object's fields
  exposes the internal representation of the object.&nbsp;
   If instances
   are accessed by untrusted code, and unchecked changes to
   the mutable object would compromise security or other
   important properties, you will need to do something different.
  Returning a new copy of the object is better approach in many situations.</p>

    <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="EI_EXPOSE_REP2">May expose internal representation by incorporating reference to mutable object</a>
      </h2>

  <p> This code stores a reference to an externally mutable object into the
  internal representation of the object.&nbsp;
   If instances
   are accessed by untrusted code, and unchecked changes to
   the mutable object would compromise security or other
   important properties, you will need to do something different.
  Storing a copy of the object is better approach in many situations.</p>

    <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="EXS_EXCEPTION_SOFTENING_HAS_CHECKED">Constrained method converts checked exception to unchecked instead of another allowable checked exception</a>
      </h2>
			
			<p>This method's exception signature is constrained by an interface of superclass not to throw a
			checked exception that was caught. Therefore this exception was converted to an unchecked exception and
			thrown. It would probably be better to throw the closest checked exception allowed, and to annotate
			the new exception with the original exception using the initial cause field.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS">Unconstrained method converts checked exception to unchecked</a>
      </h2>
			
			<p>This method is not constrained by an interface or superclass, but converts a caught checked exception
			to an unchecked exception and throws it. It would be more appropriate just to throw the checked exception,
			adding the exception to the throws clause of the method.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY">Class has a circular dependency with other classes</a>
      </h2>
		   
		    <p>
		    This class has a circular dependency with other classes. This makes building these classes
		    difficult, as each is dependent on the other to build correctly. Consider using interfaces
		    to break the hard dependency. The dependency chain can be seen in the GUI version of FindBugs.
		    </p>
		    
        <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="ITC_INHERITANCE_TYPE_CHECKING">Method uses instanceof on multiple types to arbitrate logic</a>
      </h2>
			
			<p>This method uses the instanceof operator in a series of if/else statements to
			differentiate blocks of code based on type. If these types are related by inheritance,
			it is cleaner to just define a method in the base class, and use overridden methods
			in these classes.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="OCP_OVERLY_CONCRETE_PARAMETER">Method needlessly defines parameter with concrete classes</a>
      </h2>
			
			<p>This method uses concrete classes for parameters when only methods defined in an implemented
			interface or superclass are used. Consider increasing the abstraction of the interface to
			make low impact changes easier to accomplish in the future.</p>

			<p>Take the following example:<br/>
<pre><code>
private void appendToList(ArrayList&lt;String&gt; list) {
    if (list.size() &lt; 100) {
        list.add("Foo");
    }
}
</code></pre>

				The parameter list is currently defined as an <code>ArrayList</code>, which is a concrete implementation of the <code>List</code> interface.
				Specifying <code>ArrayList</code> is unnecessary here, because we aren't using any <code>ArrayList</code>-specific methods (like <code>ensureCapacity()</code> or <code>trimToSize()</code>).
				Instead of using the concrete definition, it is better to do something like:<br/>
<pre><code>
private void appendToList(List&lt;String&gt; list) {
    ...
</code></pre>
				If the design ever changes, e.g. a <code>LinkedList</code> is used instead, this code won't have to change.

			</p>

			<p>IDEs tend to have tools to help generalize parameters.  For example, in Eclipse, the refactoring tool <a href="http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-menu-refactor.htm">Generalize Declared Type</a> helps find an appropriate level of concreteness.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="PSC_PRESIZE_COLLECTIONS">Method does not presize the allocation of a collection</a>
      </h2>
			
			<p>This method allocates a collection using the default constructor even though it is known
			a priori (or at least can be reasonably guessed) how many items are going to be placed in the collection,
			and thus needlessly causes intermediate reallocations of the collection.</p>
			<p>You can use the constructor that takes an initial size and that will be much better, but
			due to the loadFactor of Maps and Sets, even this will not be a correct estimate.</p>
			<p>If you are using Guava, use its methods that allocate maps and sets with a predetermined size,
			to get the best chance for no reallocations, such as:
			<ul>
			    <li>Sets.newHashSetWithExpectedSize(int)</li>
			    <li>Maps.newHashMapWithExpectedSize(int)</li>
			</ul>
			If not, a good estimate would be the expectedSize / {LOADING_FACTOR} which by default is 0.75
			</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="S508C_NO_SETLABELFOR">JLabel doesn't specify what it's labeling</a>
      </h2>
			
			<p>This class uses JLabels that do not specify what fields are being labeled.
			This hampers screen readers from giving appropriate feedback to users. Use
			the JLabel.setLabelFor method to accomplish this.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="S508C_NON_TRANSLATABLE_STRING">Method passes constant string to title/label of component</a>
      </h2>
			
			<p>This method creates a component and passes a string literal to the title or label
			of the component. As this string will be shown to users, it should be internationalizable
			through the use of a resource bundle.</p>
			
		<p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="PREDICTABLE_RANDOM">Predictable pseudorandom number generator</a>
      </h2>
            
<p>The use of a predictable random value can lead to vulnerabilities when used in certain security critical contexts. For example, when the value is used as:</p>
<ul>
<li>a CSRF token: a predictable token can lead to a CSRF attack as an attacker will know the value of the token</li>
<li>a password reset token (sent by email): a predictable password token can lead to an account takeover, since an attacker will guess the URL of the "change password" form</li>
<li>any other secret value</li>
</ul>
<p>
A quick fix could be to replace the use of <code>java.util.Random</code> with something stronger, such as <code>java.security.SecureRandom</code>.
</p>
<p>
<b>Vulnerable Code:</b><br/>
<pre>String generateSecretToken() {
    Random r = new Random();
    return Long.toHexString(r.nextLong());
}</pre>
</p>
<p>
<b>Solution:</b>
<pre>import org.apache.commons.codec.binary.Hex;

String generateSecretToken() {
    SecureRandom secRandom = new SecureRandom();

    byte[] result = new byte[32];
    secRandom.nextBytes(result);
    return Hex.encodeHexString(result);
}</pre>
</p>
<br/>
<p>
<b>References</b><br/>
<a href="https://jazzy.id.au/2010/09/20/cracking_random_number_generators_part_1.html">Cracking Random Number Generators - Part 1 (https://jazzy.id.au)</a><br/>
<a href="https://www.securecoding.cert.org/confluence/display/java/MSC02-J.+Generate+strong+random+numbers">CERT: MSC02-J. Generate strong random numbers</a><br/>
<a href="https://cwe.mitre.org/data/definitions/330.html">CWE-330: Use of Insufficiently Random Values</a><br/>
<a href="https://blog.h3xstream.com/2014/12/predicting-struts-csrf-token-cve-2014.html">Predicting Struts CSRF Token (Example of real-life vulnerability and exploitation)</a>
</p>

        <p>
         <br/>
         <br/>
      </p>
      <h2>
         <a name="UEC_USE_ENUM_COLLECTIONS">Class uses an ordinary set or map with an enum class as the key</a>
      </h2>
			
			<p>This class uses an ordinary set or map collection and uses an enum class as the key type.
			It is more performant to use the JDK 1.5 EnumSet or EnumMap classes.</p>
			
		<p>
         <br/>
         <br/>
      </p>
   </body>
</html>
